﻿using FreeSql;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BBCore.Core.Models.Admins
{
    [Table(Name = "HYJ_ROLE")]
    [Description("角色表")]
    [Index("uk_RoleName", "RoleName", true)] //唯一键    
    public class RoleEntity : BaseEntity<RoleEntity, int>
    {
        [Display(Name = "角色名称")]
        [Required(ErrorMessage = "角色名称不可为空")]
        public string? RoleName { get; set; }

        [Navigate(nameof(UserEntity.RoleId))]
        public List<UserEntity>? Users { get; set; }

        [Navigate(ManyToMany = typeof(RoleMenuEntity))]
        public List<MenuEntity>? Menus { get; set; }
    }
}
